#include "matopeli.h"

matopeli::matopeli(QGraphicsView *parent) : QGraphicsView(parent)
{
    InitGameArea();
}

void matopeli::InitGameArea()
{
    topBorder = new QGraphicsLineItem(-200,-150,200,-150);
    bottomBorder = new QGraphicsLineItem(-200,150,200,150);
    leftBorder = new QGraphicsLineItem(-200,-150,-200,150);
    rightBorder = new QGraphicsLineItem(200,-150,200,150);

    scene = new QGraphicsScene();
    scene->setSceneRect(-200,-150,400,300);
    scene->setItemIndexMethod(QGraphicsScene::NoIndex);
    scene->addItem(topBorder);
    scene->addItem(bottomBorder);
    scene->addItem(leftBorder);
    scene->addItem(rightBorder);

    this->setMinimumSize(400,400);
    this->setScene(scene);
    this->setAlignment((Qt::AlignCenter | Qt::AlignCenter));
    this->setViewport(new QGLWidget());
    this->setViewportUpdateMode(QGraphicsView::BoundingRectViewportUpdate);
    this->setRenderHint(QPainter::Antialiasing);

    this->show();
}
matopeli::~matopeli()
{
    scene->deleteLater();
}
